package cn.tedu.spring.bean;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author tune_the last
 * @date 2025/11/6 - 14:21
 */
@Component
public class UserDao {
    @Value("jdbc:mysql://localhost:3306/tedu?characterEncoding=utf8")
    private String url;
    @Value("root")
    private String username;
    @Value("ASD13579asd")
    private String password;
    /*
        @Value注解：
        1.依赖注入的注解，支持注入基本类型的数据，比如String、其他的基本类型;
        2.支持属性注入、set方法注入
     */

    public void setUrl(String url) {
        this.url = url;
    }
    @Value("root")
    public void setUsername(String username) {
        this.username = username;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public String toString() {
        return "UserDao{" +
                "url='" + url + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                '}';
    }
}
